package com.litongjava.ai.server.padddle.ocr.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RestResponse<T> {
    private Integer code;
    private String message;
    private T data;

    public static <T> RestResponse<T> ok(T data) {
        return new RestResponse<>(200, "成功", data);
    }

    public static <T> RestResponse<T> ok() {
        return new RestResponse<>(200, "成功", null);
    }

    public static <T> RestResponse<T> fail(String message) {
        return new RestResponse<>(500, message, null);
    }

    public static <T> RestResponse<T> fail() {
        return new RestResponse<>(500, "失败", null);
    }
}